//
//  Memory.h
//  Memento 2.0
//
//  Created by Chris Maddocks on 10-06-27.
//  Copyright 2010 Team Memento. All rights reserved.
//
//  Description: represents an individual memory record.  Image and audio data is not stored in the Memory record, but
//  rather is referenced by filename (relative to a photo collection, not fully-qualified).  Calling code will generally
//  not create memories directly, but instead will interact with the PhotoCollection to generate new memories (via a factory
//  method) and to access memories managed within a photo collection.
//
//  10-08-02: Use consistent keys for NSCoding and initWithDictionary:  (C. Maddocks)
//  10-08-01: Add distance property for sorting and display  (C. Maddocks)
//  10-07-21: Bump version in header to 2.0.  (C. Maddocks)
//  10-07-06: change image member variable to filename instead of UIImage  (C. Maddocks)
//  10-07-05: Memory.h and Memory.m finalized for version 1. (C. Maddocks)

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>


extern NSString *kMemoryId;
extern NSString *kImageFile;
extern NSString *kAudioFile;
extern NSString *kDateTime;
extern NSString *kLatitude;
extern NSString *kLongitude;



@interface Memory : NSObject <NSCoding> {
	int memoryId;
	NSDate *dateTime;
	
	NSString *imageFile;
	NSString *audioFile;
	
	UIImage *image;
	BOOL saving;
	
	CLLocationCoordinate2D location;	
	CLLocationDistance distance;
}

- (id)initWithDictionary:(NSDictionary *)aDictionary;
- (id)initWithMemoryId:(int)aMemoryId;
- (NSString *)generateFileNameWithExt:(NSString *)ext;

- (CLLocationDistance)updateDistanceFromLocation:(const CLLocation *)location;

@property (nonatomic, readonly) int memoryId;
@property (nonatomic, retain) NSDate *dateTime;
@property (nonatomic, retain) NSString *imageFile;
@property (nonatomic, retain) NSString *audioFile;
@property (nonatomic, assign) CLLocationCoordinate2D location;
@property (nonatomic, assign) CLLocationDistance distance;

@property (nonatomic, retain) UIImage *image;
@property (nonatomic, assign) BOOL saving;

@end
